/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package linkeddata.arida.ufc.br.endpoints;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 *
 * @author jeovane
 */
public class Prefix {

    private LoadFileUrl load;

    public Prefix(LoadFileUrl load) {
        this.load = load;
    }

    public Map<String, String> mapSources() {
        Map<String, String> sources = new LinkedHashMap<String, String>();
        for (String pre : load.linesArq()) {
            load.prefixes = pre.split(" ");
            if (load.prefixes[1].endsWith("*:")) {
                sources.put(load.prefixes[1].replace("*:", "").toLowerCase(), load.prefixes[2].replace("<", "").replace(">", "").toLowerCase());
            }
        }
        return sources;
    }

    public String prefixes() {
        String prefixe = "";
        for (String pre : load.linesArq()) {
            load.prefixes = pre.split(" ");
            if (load.prefixes[1].endsWith("*:")) {
                prefixe += load.prefixes[0].toUpperCase() + " " + load.prefixes[1].replace("*:", "").toLowerCase() + ": " + load.prefixes[2].toLowerCase() + "\n";
            } else {
                prefixe += load.prefixes[0].toUpperCase() + " " + load.prefixes[1].toLowerCase() + " " + load.prefixes[2].toLowerCase() + "\n";
            }

        }
        return prefixe;
    }
}
